'use strict'

let routes = [];
//login
let loginState = {
    name: 'login',
    url: '/login',
    component: 'login'
}
routes.push(loginState);

//main
let mainState = {
    name: 'main',
    url: '/main/:orgId',
    component: 'main'
}
routes.push(mainState);

//admin
let adminState = {
    name: 'admin',
    url: '/admin',
    component: 'admin'
}
routes.push(adminState);

//exam detail
let examDetailState = {
    name:'main.exam',
    url:'/exam',
    component:'exam',
    parent:'main'
}
routes.push(examDetailState);

//exam analysis
let analysisState = {
    name:'main.analysis',
    url:'/analysis',
    component:'analysis',
    parent:'main'
}
routes.push(analysisState);

//students list
let stuState = {
    name:'main.students',
    url:'/students',
    component:'students',
    parent:'main'
}
routes.push(stuState);

//org users
let orgUsersState = {
    name:'main.orgUsers',
    url:'/orgUsers',
    component:'orgUsers',
    parent:'main'
}
routes.push(orgUsersState);



//////////////////   admin   /////////////////////////////
//exam detail
let examsState = {
    name:'admin.exams',
    url:'/exams',
    component:'exams',
    parent:'admin'
}
routes.push(examsState);

//organization list
let orgState = {
    name:'admin.orgs',
    url:'/orgs',
    component:'orgs',
    parent:'admin'
}
routes.push(orgState);

//regist routes
function routeConfig($stateProvider) {
    routes.forEach(r => {
        $stateProvider.state(r);

    })
}
angular.module('root').config(routeConfig);